ifndef $(CPU_TARGET)
override CPU_TARGET=i386
endif

KERNELNAME=kernel

all: kernel

kernel: runtime
	fpc -P$(CPU_TARGET) $(OPT) -o$(KERNELNAME) kernel

runtime:
	make -C rtl $(RTL_OPT) all

runtime_clean:
	make -C rtl clean

clean: runtime_clean
	rm -f $(KERNELNAME) $(wildcard *.ppu *.o */*.o */*ppu)
	rm -f $(wildcard i386/*.o i386/*.ppu i386/generic/*.o i386/generic/*.ppu i386/pc/*.o i386/pc/*.ppu)